import { createApp } from "vue";
import { createPinia } from "pinia";
import App from '@/App.vue'//root根节点
import router from '@/router'
import ElementPlus from 'element-plus'
import locale from 'element-plus/es/locale/lang/zh-cn'

import 'element-plus/dist/index.css'

//引入css公共样式
import '../public/static/css/global.css'

import perm from '@/directives/perm.js'
import * as ElementPlusIconsVue from '@element-plus/icons-vue';

// 导入xlsx
import * as XLSX from 'xlsx'

// 修正导入路径
import zhLocale from 'element-plus/es/locale/lang/zh-cn';
import Echarts from 'vue-echarts'
import "echarts";

let pinia = createPinia()
let app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(ElementPlus, { locale: zhLocale });

// 全局挂载 echarts
// app.config.globalProperties.$echarts = echarts;
app.component('ECharts', Echarts)
app.use(router)
app.use(pinia)
app.use(XLSX)
app.use(ElementPlus, {
    locale: locale
})
app.directive('perm', perm)
app.mount("#app")
